package springboot.springboot06_ssmp.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.RedirectView;

/**
 * @author daiqiang
 * @since 2024/6/14-13:37
 */
@Slf4j
@CrossOrigin  //允许跨域
@RestController
public class RootController {
    @GetMapping("/")

    public String redirectToIndex() {
        System.out.println("ok");
        // 直接返回视图名称，假设index.html在static目录下
        return "redirect:/login.html"; // 发送HTTP重定向到login.html页面
    }
}
